%this is a function that takes as input the geographic location of two places in
%Latitude and Longitude and returns distance in kilometers between two places.
%it is used in the script "Assign_Weather_to_Individuals.m".

function d=Distance(lat1,lon1,lat2,lon2)
R=6371; %the radius of earth
lat1r=lat1*pi/180;
lat2r=lat2*pi/180;
lon1r=lon1*pi/180;
lon2r=lon2*pi/180;


d=acos(sin(lat1r).*sin(lat2r)+cos(lat1r).*cos(lat2r).*cos((lon2r-lon1r)))*R;
